package com.huike.game.Activity;

import android.annotation.SuppressLint;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.huike.game.R;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

public class GameActivity54 extends AppCompatActivity {

    private ImageView iv_left_image;
    private TextView tv_left_text;
    private TextView tv_content_title;
    private ImageView iv_rigth_image;
    private TextView tv_right_text;
    private   ConnectivityManager managerCompat;

    @SuppressLint("ServiceCast")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_game54);

         managerCompat = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE);


        initView();
    }

    private void initView() {
        iv_left_image = (ImageView) findViewById(R.id.iv_left_image);
        tv_left_text = (TextView) findViewById(R.id.tv_left_text);
        tv_content_title = (TextView) findViewById(R.id.tv_content_title);
        iv_rigth_image = (ImageView) findViewById(R.id.iv_rigth_image);
        tv_right_text = (TextView) findViewById(R.id.tv_right_text);

        iv_rigth_image.setVisibility(View.GONE);
        tv_right_text.setVisibility(View.GONE);

        tv_content_title.setText("网络检查");

        tv_left_text.setVisibility(View.GONE);

        iv_left_image.setImageResource(R.drawable.tiao);


    }

    public void csNetWork(View view) {

        NetworkInfo network = managerCompat.getActiveNetworkInfo();
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        AlertDialog dialog = builder.create();
        if(network != null){
            dialog.setTitle("提示");
            dialog.setMessage("网络连接");

        }else{
            dialog.setTitle("提示");
            dialog.setMessage("网络断开");

        }



        dialog.show();


    }

}
